package Day17;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        ArrayList<String> list = new ArrayList<>();
        TreeSet<Integer> set = new TreeSet<>();
        int n = scan.nextInt();
        for(int i = 0; i < n; i++){
          list.add(scan.next());
          set.add(scan.nextInt());
        }

        for(Integer x : set){
          System.out.println(x);
        }
        scan.close();
    }
}